package com.iss.apartmentmanage.config.menu;

import com.iss.apartmentmanage.entity.Menu;
import java.util.ArrayList;
import java.util.List;

public class MenuTreeUtils {

    public static List<Menu> generateMenuTree(List<Menu> directoryInfoList){
        List<Menu>  menuList= new ArrayList<Menu>();
        for (Menu menu: directoryInfoList){
            menuList.add(new Menu(menu.getId(),menu.getMenuName(),menu.getMenuCode(),menu.getParentId(),menu.getStatus(),menu.getIcon()));
        }
        MenuTree menuTree = new MenuTree(menuList);
        menuList = menuTree.builTree();
        return menuList;
    }
}
